package com.example.wananrdroid.model;

import com.example.wananrdroid.base.BaseModel;
import com.example.wananrdroid.base.BaseObserver;
import com.example.wananrdroid.bean.WenBean;
import com.example.wananrdroid.not.ApiService;
import com.example.wananrdroid.not.HttpUlist;
import com.example.wananrdroid.not.RxUlist;

import io.reactivex.Observable;

public class WenModel extends BaseModel {
    public void wendata(WenCallBack callBack){
        ApiService apiServer = new HttpUlist().getApiServer(ApiService.wan, ApiService.class);
        Observable<WenBean> getwendata = apiServer.getwendata();
        getwendata.compose(RxUlist.ReObservableTransformer())
                .subscribe(new BaseObserver<WenBean>(this) {
                    @Override
                    protected void onSuccess(WenBean wenBean) {
                        callBack.onSuccess(wenBean);
                    }

                    @Override
                    protected void onFali(String message) {
                        callBack.onFali(message);
                    }
                });
    }
}
